//
//  UpdateBookingViewController.h
//  mUBB
//
//  Created by Cosmin Stirbu on 3/6/13.
//  Copyright (c) 2013 Cosmin Stirbu. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "BaseViewController.h"
#import "Booking.h"
#import "KalView.h"
#import "KalLogic.h"
#import "CustomPickerView.h"
#import "BookingsProtocol.h"

@class UpdateBookingViewController;

@protocol UpdateBookingDelegate <NSObject>

- (void)didFinishUpdatingBooking:(UpdateBookingViewController *)updateBookingViewController refreshBookings:(BOOL)refreshBookings;
@end


@interface UpdateBookingViewController : BaseViewController<UITableViewDataSource, UITableViewDelegate, KalViewDelegate, CustomPickerViewProtocol, BookingsProtocol, UIAlertViewDelegate, UIPopoverControllerDelegate> {
    // Booking to edit / Create
    Booking *_booking;
    
    // Number of sections
    NSInteger _numberOfSections;
    
    // Indicates if start time was set
    BOOL _startTimeWasSet;
    
    // Indicates if end time was set
    BOOL _endTimeWasSet;

    // Calendar Pop Over
    IBOutlet UIView *calendarPopOver;
    
    // Calendar View
    KalView *kalView;
    
    // Calendar logic
    KalLogic *logic;
    
    // NSDate Selected Date
    NSDate *_selectedDate;
    
    // Selected Start Time
    NSDate *_selectedStartTime;
    
    // Selected End Time
    NSDate *_selectedEndTime;
    
    // Indicates if the Picker View is for start time or for ending time
    BOOL _isStartTime;
    
    // Time Picker View
    CustomPickerView *_timePickerView;
    
    // Pop over controller for iPad
    UIPopoverController *ipadPopOverController;
}


// Delegate
@property (nonatomic, assign) id<UpdateBookingDelegate> delegate;

// Indicates if it was presented for creating a booking or for updating one
@property (nonatomic, assign) BOOL updatingBooking;

// Table View
@property (unsafe_unretained, nonatomic) IBOutlet UITableView *bookingTableView;


// Select
- (id)initWithNibName:(NSString *)nibNameOrNil booking:(Booking *)booking course:(Course *)course;

@end

